package com.ithuameng.admin.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonCreator.Mode;
import com.fasterxml.jackson.annotation.JsonValue;

import lombok.Getter;

/**
 * Job Status
 *
 * @author ithuameng
 */
@Getter
public enum JobStatus implements IEnum<String>, AdminEnumStrValue {

    /**
     * 工作中
     */
    WORKING("W"),

    /**
     * 停止中
     */
    STOPED("S");

    JobStatus(String value) {
        this.value = value;
    }

    @JsonValue
    private String value;

    @JsonCreator(mode = Mode.DELEGATING)
    public static JobStatus forValue(String value) {
        JobStatus[] enums = JobStatus.values();
        for (JobStatus e : enums) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
